package com.example.android.gorillas.kanji2roma;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class Kanji2RomaActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Button button_convert = (Button) findViewById(R.id.convert);
        
        button_convert.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
		        EditText inputtext = (EditText) findViewById(R.id.inputtext);
		        TextView romantext = (TextView) findViewById(R.id.roman);
		        Kanji2RomaByWeb converter = new Kanji2RomaByWeb();
		        
				String convertedString = converter.getRoman(inputtext.getText().toString());
				if (convertedString != null)
					romantext.setText(convertedString);
			}
		});
        
    }
}